home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d14
/
baswind8.arc
/
MAKEWIND.SUB
< prev
next >
Wrap
Text File
|
1990-09-14
|
8KB
|
236 lines
'
'
'******************************************************************************
' Function : MAKEWIND *
' *
' Purpose: *
' *
' *
' Results: *
' *
' Usage : *
' *
' *
' Date Written : 09/01/90 - Date Tested: 09/01/90 - Author: James P Morgan *
' Date Modified: - : - : *
'-----------------------------------------------------------------------------*
' NOTE: *
'******************************************************************************
' *
' SUB PROGRAM NAME (PARAMETERS) STATIC/RECURSIVE *
'-----------------------------------------------------------------------------*
' *
SUB MAKEWIND(ULR%,ULC%,LRR%,LRC%,FRAME%,FORE%,BACK%,GROW%,SHADOW%,LABEL$,RETURN.CODE%) STATIC
DEFINT A-Z 'make all short intergers by default
RETURN.CODE%=0
VIDEO.RETURN.CODE%=0
IF GROW%=0 THEN 'is the window to "grow" onto the screen
GOSUB MAKEWIND.STD
GOSUB MAKEWIND.SHADE
GOTO MAKEWIND.DONE
END IF
'-------------------- Growing Window Module ---------------------------
' SHADOW%=0 'grow and shadow no longer mutually exclusive
X1=ULC%+(INT((LRC%-ULC%)\2))
X2=LRC%-(INT((LRC%-ULC%)\2))
Y1=ULR%+(INT((LRR%-ULR%)\2))
Y2=LRR%-(INT((LRR%-ULR%)\2))
'
MAKEWIND.NXT:
IF X1>ULC% THEN
X1=X1-3
IF X1<ULC% THEN
X1=ULC%
END IF
END IF
IF X2<LRC% THEN
X2=X2+3
IF X2>LRC% THEN
X2=LRC%
END IF
END IF
IF Y1>ULR% THEN
Y1=Y1-1
END IF
IF Y2<LRR% THEN
Y2=Y2+1
END IF
GOSUB MAKEWIND.SETUP
IF (X1=ULC%) AND (X2=LRC%) AND (Y1=ULR%) AND (Y2=LRR%) THEN
GOSUB MAKEWIND.SHADE
GOTO MAKEWIND.DONE
END IF
GOTO MAKEWIND.NXT
'
'------------------- Regular Window Module ----------------------------
MAKEWIND.STD:
X1=ULC%
X2=LRC%
Y1=ULR%
Y2=LRR%
MAKEWIND.SETUP:
ATTR=(BACK% AND 7)*16+FORE%
IF FRAME%<0 OR FRAME%>4 THEN 'if frame invalid, then no frame
FRAME%=0
END IF
SELECT CASE FRAME%
CASE 0
GOSUB MAKEWIND.NOFRAME
CASE 1
GOSUB MAKEWIND.H1V1
CASE 2
GOSUB MAKEWIND.H2V2
CASE 3
GOSUB MAKEWIND.H1V2
CASE 4
GOSUB MAKEWIND.H2V1
END SELECT
IF (LABEL$="") OR (LEN(LABEL$) > LEN(TOP$)-5) THEN
GOTO MAKEWIND.MAKE
END IF
'
' center the heading on top of the window
'
MID$(TOP$,(LEN(TOP$)/2)-((LEN(LABEL$)+1)/2))="["+LABEL$+"]"
'
'------------------------ Produce Window Module -----------------------
MAKEWIND.MAKE:
ROW=Y1-1
COL=X1-1
CALL FASTPRT(TOP$,ROW,COL,ATTR,VIDEO.RETURN.CODE%)
FOR I=Y1 TO Y2
ROW=I
COL=X1-1
CALL FASTPRT(MIDL$,ROW,COL,ATTR,VIDEO.RETURN.CODE%)
NEXT
ROW=Y2+1
COL=X1-1
CALL FASTPRT(BOTTM$,ROW,COL,ATTR,VIDEO.RETURN.CODE%)
RETURN
'
'--------------- Single Line Frame ---------------------
MAKEWIND.H1V1:
TOP$ =CHR$(218)+STRING$((X2-X1)+1,196)+CHR$(191)
MIDL$ =CHR$(179)+STRING$((X2-X1)+1, 32)+CHR$(179)
BOTTM$=CHR$(192)+STRING$((X2-X1)+1,196)+CHR$(217)
RETURN
'
'--------------- Double Line Frame ----------------------
MAKEWIND.H2V2:
TOP$ =CHR$(201)+STRING$((X2-X1)+1,205)+CHR$(187)
MIDL$ =CHR$(186)+STRING$((X2-X1)+1, 32)+CHR$(186)
BOTTM$=CHR$(200)+STRING$((X2-X1)+1,205)+CHR$(188)
RETURN
'
'---- Double Vertical, Single Horizontal Line Frame ----
MAKEWIND.H1V2:
TOP$ =CHR$(214)+STRING$((X2-X1)+1,196)+CHR$(183)
MIDL$ =CHR$(186)+STRING$((X2-X1)+1, 32)+CHR$(186)
BOTTM$=CHR$(211)+STRING$((X2-X1)+1,196)+CHR$(189)
RETURN
'
'---- Double Horizontal, Single Vertical Line Frame ----
MAKEWIND.H2V1:
TOP$ =CHR$(213)+STRING$((X2-X1)+1,205)+CHR$(184)
MIDL$ =CHR$(179)+STRING$((X2-X1)+1, 32)+CHR$(179)
BOTTM$=CHR$(212)+STRING$((X2-X1)+1,205)+CHR$(190)
RETURN
'
'---------------- No Frame ----------------------------
MAKEWIND.NOFRAME:
TOP$=SPACE$((X2-X1)+3)
MIDL$=TOP$
BOTTM$=TOP$
RETURN
'
'---------------------------- Shadow Module ---------------------------
MAKEWIND.SHADE:
IF SHADOW%=0 THEN 'are we to "shade" the window
RETURN
END IF
X1=ULC%
X2=LRC%
Y1=ULR%
Y2=LRR%
COL=X1-3 'allow for window frame and 2 "shadow" columns
IF COL<1 OR COL>80 THEN 'still within physical screen co-ordinates
SHADOW%=0 'NO, so no shadow, even if requested
RETURN
END IF
DAT$=" " 'allow for 2 "shadow" colums
BLACK=&H07 'low intensity white on black
'
' draw the shadow around the window frame
'
FOR I=Y1 TO (Y2+2)
ROW=I
V=SCREEN(I,COL) 'get the two left chars outside the window frame
MID$(DAT$,1,1)=CHR$(V) 'from the physical screen
V=SCREEN(I,COL+1)
MID$(DAT$,2,1)=CHR$(V)
'
' are we on the last line of the window, just below the botttom window frame.
'
IF I=Y2+2 THEN
DAT$=STRING$(80," ") 'intialize to cut down on string collection
CHAR.CNT=0 'keep track of length of string
FOR J=COL TO COL+((X2-X1)+3)
CHAR.CNT=CHAR.CNT+1
V=SCREEN(I,J) 'get the char from screen, that will be in shadow
MID$(DAT$,CHAR.CNT,1)=CHR$(V) 'and save it with the rest
NEXT
DAT$=LEFT$(DAT$,CHAR.CNT) 'now adjust for real string length
END IF
CALL FASTPRT(DAT$,ROW,COL,BLACK,VIDEO.RETURN.CODE%)
NEXT
RETURN
'
MAKEWIND.DONE:
GROW%=0
DAT$="" 'free up any string space used
TOP$=""
MIDL$=""
BOTTM$=""
END SUB